|
|
|
| True or False value. If its True, the item is added to the strAddr variable from the List() property at the index of the loop variable. After all the selected items have been retrieved from the list box, the value of the strAddr variable is assigned to the Text property of the txtTo text box. In the above example, I used the With...End With construct. This is used so you dont have to keep typing the list box name over and over again. You can just use the property names with a preceding dot. |
|
|
|
|
|
|
Any of the conditional logic or looping constructs can be nested within one another. For example, you can have an If statement within a loop, or you can have an If statement in a Case statement. You can have a Do...While loop within a For...Next loop or even inside of a Case statement. You can even have three or more For...Next loops one within another. |
|
|
|
|
|
|
|
|
Sometimes you might need to exit out of a For or Do loop early. You can accomplish this in one of two ways: You can set some value so the condition will drop you out of the loop, or you can use either an Exit For or Exit Do statement. Obviously, Exit For is used when youre in a For...Next loop, and the Exit Do is used when youre in a Do...While loop. The Exit statement only exits from the loop its coded within. This means that if you have nested loops, you may need multiple Exit statements. Heres an example: |
|
|
|
 |
|
|
|
|
For intLoop = 1 To 5
Print intLoop
If intLoop = 3 Then
Exit For
End If
Next intLoop |
|
|
|
|
|
|
|
|
Just as you might need to exit a loop early, you might sometimes need to exit a procedure early. To accomplish this, use the Exit Sub or Exit Function statement. Heres an example: |
|
|
|
|
|